package cn.edu.sxw.web.server.service;

import cn.edu.sxw.web.server.bean.User;

public class UserTokenService {
    public String getToken(String login){
        return "thisisatoken."+login+".tokenend";
    }


    public User getUser(String token){
        try{
            //解析出login
            String login = token.split("\\.")[1];
            //调用账户数据服务，查询出login对应的账户信息
            AccountService accountService=new AccountService();
            User user=accountService.getUserByLogin(login);
            return user;
        }catch (Exception e){
            e.printStackTrace();
        }
        return null;
    }

}
